#ifndef __SOFT_PRINTER_DEV__
#define __SOFT_PRINTER_DEV__

#include <stdint.h>
#include <stdbool.h>


#define DEFAULT_COMPANY				"Metis"
#define MODEL_213				0
#define MODEL_583				2
#define MODEL_750				1
#define DEFAULT_MODEL				MODEL_213
#define COLOR_MONOCHROME			0
#define COLOR_TRICOLOR				1
#define DEFAULT_COLOR				COLOR_TRICOLOR
#define MODEL_213_WIDTH				250
#define MODEL_213_HEIGHT			128
#define MODEL_583_WIDTH				648
#define MODEL_583_HEIGHT			480
#define MODEL_750_WIDTH				800
#define MODEL_750_HEIGHT			480
#define DEFAULT_MODEL_WIDTH			MODEL_213_WIDTH
#define DEFAULT_MODEL_HEIGHT		MODEL_213_HEIGHT
#define DEFAULT_SERIAL_NUMMBER		"METIS-MINK-00000000"

#define DEFAULT_HW_VER_MAJOR		1
#define DEFAULT_HW_VER_MINOR		0

#define DEFAULT_SOFT_VER_MAJOR		1
#define DEFAULT_SOFT_VER_MINOR		0
#define DEFAULT_SOFT_VER_PATCH		0

#define SOFT_MAJOR_NUMBER			2
#define SOFT_MINOR_NUMBER			0
#define SOFT_PATCH_NUMBER			1

#define STR(_X_)				#_X_
#define NAMETOVALUE(NAME)			STR(NAME)

#define SOFT_VER_STRING				(NAMETOVALUE(SOFT_MAJOR_NUMBER)"."\
						NAMETOVALUE(SOFT_MINOR_NUMBER)"."\
						NAMETOVALUE(SOFT_PATCH_NUMBER))

typedef int32_t esp_err_t;

typedef struct {
	uint8_t major;
	uint8_t minor;
} mink_hw_ver_t;

typedef struct {
	uint8_t major;
	uint8_t minor;
	uint8_t patch;
} mink_soft_ver_t;

typedef struct {
	char company[16];
	char serial[32];
	uint8_t mac[8];

	struct {
		uint32_t type: 1,
			 color: 1,
			 width:10,
			 height: 10,
			 restart: 1,
			 rsv: 9;
	} model;

	mink_hw_ver_t hw;
	mink_soft_ver_t soft;
} device_info_config_t;

typedef struct {
	int32_t (*eink_init)(void *,bool, const uint8_t);
	int32_t (*eink_deinit)(void *);
	int32_t (*power_down)(void *);
	int32_t (*power_up)(void *);
	int32_t (*rest)(void *);
	int32_t (*chk_busy)(void *);

	int32_t (*cmd)(void *, const uint8_t);
	int32_t (*clear)(void *);
	int32_t (*refresh)(void *);
	int32_t (*sleep)(void *);

	int32_t (*data)(void *, const uint8_t *, uint32_t);

} dev_soft_drv;

typedef struct {
	/* data */
	uint8_t disp_mode;
	device_info_config_t *dev;
	dev_soft_drv *drv;
} virt_dev_drv;

typedef void* sse320_handle_t;

typedef struct {
	/* data */
} spi_host_device_t;

typedef enum {
	EINK_7P5 = 1,
	EINK_5P83,
	EINK_SIZE_MAX
}e_eink_size;

sse320_handle_t virt_create_dev(spi_host_device_t spi_host, e_eink_size screen_size, uint8_t mode);

esp_err_t virt_delete_dev(sse320_handle_t dev);

#endif